//
//  ClubMessageDetailViewController.swift
//  77Club
//
//  Created by Apple on 2024/9/3.
//

import UIKit

class ClubMessageDetailViewController: ClubBaseViewController {

    private let backButton = c_make_ex(UIButton.self)
        .image("Common_blackBack").end()
    private let titleLabel = c_make_ex(UILabel.self)
        .color(.black).font(16.font_semiBold).end()
    private let bgView = c_make_ex(UIView.self)
        .bgColor(.white).corner(12.0.Scale).end()
    private let nameLabel = c_make_ex(UILabel.self)
        .color("#565656").font(17.font_regular).alignment(.center).end()
    private let timeLabel = c_make_ex(UILabel.self)
        .color("#565656").font(14.font_regular).alignment(.center).end()
    private let contentLabel = c_make_ex(UILabel.self)
        .color("#565656").font(14.font_regular).line(0).end()
    
    var model: ClubMessageModel?{
        didSet{
            guard let md = model else { return }
            
            titleLabel.text = md.name
            nameLabel.text = md.name
            timeLabel.text = md.time
            contentLabel.text = md.content
        }
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()

        view.subviews{
            backButton
            titleLabel
            bgView.subviews{
                nameLabel
                timeLabel
                contentLabel
            }
        }
        
        backButton.leading(0).top(.statusHeight).width(56).height(44)
        titleLabel.centerHorizontally()
        titleLabel.CenterY == backButton.CenterY
        bgView.leading(16).trailing(16).top(.navi_height + 12).bottom(.safe_bottom + 12)
        nameLabel.leading(15).trailing(15).top(15).centerHorizontally()
        timeLabel.leading(15).trailing(15).top(40).centerHorizontally()
        contentLabel.leading(15).trailing(15).top(70)
        
        backButton.addTarget(self, action: #selector(clickBackButton), for: .touchUpInside)
    }
    

}
